A !rst-order one-pass CPS transformation
نویسندگان
چکیده
We present a new transformation of -terms into continuation-passing style (CPS). This transformation operates in one pass and is both compositional and !rst-order. Previous CPS transformations only enjoyed two out of the three properties of being !rst-order, one-pass, and compositional, but the new transformation enjoys all three properties. It is proved correct directly by structural induction over source terms instead of indirectly with a colon translation, as in Plotkin’s original proof. Similarly, it makes it possible to reason about CPS-transformed terms by structural induction over source terms, directly. The new CPS transformation connects separately published approaches to the CPS transformation. It has already been used to state a new and simpler correctness proof of a direct-style transformation, and to develop a new and simpler CPS transformation of control-9ow information. c © 2002 Elsevier B.V. All rights reserved.
منابع مشابه
On proving syntactic properties of CPS
Higher-order program transformations raise new challenges for proving properties of their output, since they resist traditional, rst-order proof techniques. In this work, we consider (1) the \one-pass" continuation-passing style (CPS) transformation, which is second-order, and (2) the occurrences of parameters of continuations in its output. To this end, we specify the one-pass CPS transformati...
متن کاملA Simple Correctness Proof of the Direct-Style Transformation
We build on Danvy and Nielsen’s first-order program transformation into continuation-passing style (CPS) to present a new correctness proof of the converse transformation, i.e., a one-pass transformation from CPS back to direct style. Previously published proofs were based on CPS transformations that were either higher-order, noncompositional, or operating in two passes, and were correspondingl...
متن کاملA First-Order One-Pass CPS Transformation
We present a new transformation of call-by-value lambda-terms into continuation-passing style (CPS). This transformation operates in one pass and is both compositional and first-order. Because it operates in one pass, it directly yields compact CPS programs that are comparable to what one would write by hand. Because it is compositional, it allows proofs by structural induction. Because it is f...
متن کاملCPS transformation of beta-redexes
The extra compaction of the most compacting CPS transformation in existence, which is due to Sabry and Felleisen, is generally attributed to (1) making continuations occur first in CPS terms and (2) classifying more redexes as administrative. We show that this extra compaction is actually independent of the relative positions of values and continuations and furthermore that it is solely due to ...
متن کاملA Higher-Order Colon Translation
A lambda-encoding such as the CPS transformation gives rise to administrative redexes. In his seminal article “Call-by-name, call-by-value and the lambda-calculus”, 25 years ago, Plotkin tackled administrative reductions using a so-called colon translation. In “Representing control, a study of the CPS transformation”, 15 years later, Danvy and Filinski integrated administrative reductions in th...
متن کامل